public class Leetcode829 {

    public int consecutiveNumbersSum(int n) {
        int res  = 0;
        for (int i = 1; n>0; i++) {
            if (n%i==0){
                res++;
            }
            n-=i;
        }
        return res;
    }
}
